<?php
/*
 * Created on 2012-7-19
 *
 * To change the template for this generated file go to
 * Window - Preferences - PHPeclipse - PHP - Code Templates
 */
 class common_c extends MY_Controller{
 	function __construct(){
 		parent::__construct();
 	}
 	/*
 	 * 生成验证码
 	 */
 	function captcha(){
		$this->load->helper('captcha');
 		$vals = array(
		    'img_path' =>$_SERVER['DOCUMENT_ROOT'].'/ob/files/captcha/',
		    'img_url' => base_url().'files/captcha/',
		    'img_width' => '120',
		    'img_height' => '25',
		    'expiration' => '120'
	    );
		$cap = create_captcha($vals);
		$data = array(
		    'captcha_time' => $cap['time'],
		    'ip_address' => $this->input->ip_address(),
		    'word' => strtolower($cap['word'])
	    );
		$query = $this->db->insert('captcha',$data);
		$this->session->set_userdata('captcha',strtolower($cap['word']));
		print_r($cap['image']);
 	}
 }
?>
